package com.car.dal.dao.goods;

import com.car.bean.GridObj;
import com.car.bean.OrderObj;
import com.car.bean.PageObj;
import com.car.dal.dao.ibatis.IbatisCommonDao;
import com.car.dal.object.TgGoods;
import com.car.dal.object.TgGoodsAccount;
import com.car.util.Page;

import java.util.List;

public class TgGoodsAccountDaoImpl extends IbatisCommonDao<TgGoodsAccount, Long> implements TgGoodsAccountDao {

    public GridObj GetList(TgGoodsAccount tgGoodsAccount, PageObj pageObj) {
        OrderObj order = new OrderObj();
        order.setDir("desc");
        order.setSort("id");
        return super.findByPage(tgGoodsAccount, pageObj, order);
    }

    @Override
    public Integer getGoodsAccountCountInfo(TgGoodsAccount tgGoodsAccount) {
        return this.queryForInteger("getGoodsAccountCountInfo", tgGoodsAccount);
    }


    public List<TgGoodsAccount> getGoodsAccountInfo(TgGoodsAccount tgGoodsAccount, Page page) {
        tgGoodsAccount.setFirstrownum(page.getFirstrownum());
        tgGoodsAccount.setPagesize(page.getPagesize());
        List<TgGoodsAccount> list = this.queryForEntityList(TgGoodsAccount.class, "getGoodsAccountInfo", tgGoodsAccount);
        return list;
    }
}
